package at.htlkaindorf.jsf.view;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

/**
 * @author david.tomes
 */
@ManagedBean(name = "logoutBean")
@ViewScoped
public class LogoutBean implements Serializable {

    private static final long serialVersionUID = 7960005313972468840L;

    public String logout() {
        HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false);
        session.invalidate();

        // Navigation to page guestbookLogin.xhtml.
        return "guestbookLogin";
    }

}
